function CheckAll(obj) {
    var theTable = obj.parentElement.parentElement.parentElement;
    var i;
    var j = obj.parentElement.cellIndex;
    for (i = 0; i < theTable.rows.length; i++) {
        var objCheckBox = theTable.rows[i].cells[j].firstChild;
        if (objCheckBox && objCheckBox.checked != null) objCheckBox.checked = obj.checked;
    }

}
function ShowPopup(url) {
    window.top.tb_show(null, url, false);


}
function CommonConfirm(delConfirmmessage, selectItemMessage, gridID) {
    var grid = document.getElementById(gridID);
    flag = 0;
    for (i = 0; i < grid.rows.length; i++) {
        for (j = 0; j < grid.rows[i].cells.length; ++j) {
            var objCheckBox = grid.rows[i].cells[j].firstChild;
            if (objCheckBox && objCheckBox.checked != null) {
                if (objCheckBox.checked == true && objCheckBox.name.indexOf('CheckItem') > -1) {
                    flag = 1;
                    break;
                }
            }
        }
    }
    if (flag == 0) {
        alert(selectItemMessage);
        return false;
    }
    return confirm(delConfirmmessage);
}

function copyToClipBoard(rSource) {
    if (rSource != "")
        window.clipboardData.setData("Text", rSource);
}